package com.caigou.modules.query.adpter

import android.graphics.Color
import android.widget.LinearLayout
import android.widget.TextView
import com.caigou.modules.query.R
import com.caigou.modules.query.bean.DateBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2022/01/05
 */
class DateItemAdapter(dataset: MutableList<DateBean>) : BaseQuickAdapter<DateBean, BaseViewHolder>(R.layout.item_lottery_date, dataset) {
    override fun convert(holder: BaseViewHolder, item: DateBean) {
        val container = holder.getView<LinearLayout>(R.id.item_lottery_date_ll_container)
        val tvDate = holder.getView<TextView>(R.id.item_lottery_date_tv_date)
        tvDate.text = item.day.toString()
        if (item.type == 1) {
            tvDate.setTextColor(Color.parseColor("#505050"))
        } else {
            tvDate.setTextColor(Color.parseColor("#B9B9B9"))
        }
        if (item.prizeDate) {
            container.setBackgroundResource(R.drawable.img_query_date_bg)
        } else {
            container.setBackgroundResource(0)
        }
        if (item.currentDay) {
            tvDate.setBackgroundResource(R.drawable.img_query_date_checked)
        } else {
            tvDate.setBackgroundResource(0)
        }
    }
}